package com.systemsetup.systemsetup.common.utils;

import org.apache.commons.codec.binary.Base64;

import java.util.Arrays;

/**
 * @Author: YangYu
 * @ClassName: Base64Util
 * @Date: Created in 14:34 2023/4/19
 * @Description: base64工具类
 */
public class Base64Util {

    /**
     * 字符串转base64字符串
     * @param str
     */
    public static String strToBase64(String str) {
        //字符串转字节数组
        byte[] bytes = str.getBytes();
        //输出字节数组
        //System.out.println(Arrays.toString(bytes));
        String base64Encode = Base64.encodeBase64String(bytes);
        return base64Encode;
    }
}
